home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10628 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file C++ source text default
99% file C source, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 63 2b | 2b 0a 50 61 74 68 3a 20 |.lang.c+|+.Path: |
|00000020| 6e 65 77 73 2e 65 6e 67 | 2e 63 6f 6e 76 65 78 2e |news.eng|.convex.|
|00000030| 63 6f 6d 21 61 72 63 6f | 21 75 73 65 6e 65 74 0a |com!arco|!usenet.|
|00000040| 46 72 6f 6d 3a 20 46 69 | 72 73 74 6e 61 6d 65 20 |From: Fi|rstname |
|00000050| 4c 61 73 74 6e 61 6d 65 | 20 3c 4c 61 73 74 6e 61 |Lastname| <Lastna|
|00000060| 6d 65 23 6d 23 5f 46 69 | 72 73 74 6e 61 6d 65 5f |me#m#_Fi|rstname_|
|00000070| 4d 69 64 64 6c 65 49 6e | 69 74 69 61 6c 40 6d 73 |MiddleIn|itial@ms|
|00000080| 6d 61 69 6c 2e 61 61 69 | 2e 61 72 63 6f 2e 63 6f |mail.aai|.arco.co|
|00000090| 6d 3e 0a 53 75 62 6a 65 | 63 74 3a 20 52 65 3a 20 |m>.Subje|ct: Re: |
|000000a0| 51 75 65 73 74 69 6f 6e | 20 61 62 6f 75 74 20 76 |Question| about v|
|000000b0| 69 73 69 62 69 6c 69 74 | 79 20 6f 66 20 6c 6f 63 |isibilit|y of loc|
|000000c0| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 0a 58 2d 4e |al varia|bles.X-N|
|000000d0| 6e 74 70 2d 50 6f 73 74 | 69 6e 67 2d 48 6f 73 74 |ntp-Post|ing-Host|
|000000e0| 3a 20 31 33 36 2e 32 32 | 36 2e 31 30 36 2e 31 33 |: 136.22|6.106.13|
|000000f0| 33 0a 43 6f 6e 74 65 6e | 74 2d 54 79 70 65 3a 20 |3.Conten|t-Type: |
|00000100| 74 65 78 74 2f 70 6c 61 | 69 6e 3b 20 63 68 61 72 |text/pla|in; char|
|00000110| 73 65 74 3d 75 73 2d 61 | 73 63 69 69 0a 4d 65 73 |set=us-a|scii.Mes|
|00000120| 73 61 67 65 2d 49 44 3a | 20 3c 44 6e 7a 30 76 77 |sage-ID:| <Dnz0vw|
|00000130| 2e 44 36 74 40 6e 65 77 | 73 2e 61 72 63 6f 2e 63 |.D6t@new|s.arco.c|
|00000140| 6f 6d 3e 0a 54 6f 3a 20 | 67 65 6e 65 73 69 73 40 |om>.To: |genesis@|
|00000150| 66 6f 72 62 69 6e 2e 63 | 6f 6d 0a 53 65 6e 64 65 |forbin.c|om.Sende|
|00000160| 72 3a 20 75 73 65 6e 65 | 74 40 6e 65 77 73 2e 61 |r: usene|t@news.a|
|00000170| 72 63 6f 2e 63 6f 6d 0a | 43 6f 6e 74 65 6e 74 2d |rco.com.|Content-|
|00000180| 54 72 61 6e 73 66 65 72 | 2d 45 6e 63 6f 64 69 6e |Transfer|-Encodin|
|00000190| 67 3a 20 37 62 69 74 0a | 4f 72 67 61 6e 69 7a 61 |g: 7bit.|Organiza|
|000001a0| 74 69 6f 6e 3a 20 41 52 | 43 4f 20 41 6c 61 73 6b |tion: AR|CO Alask|
|000001b0| 61 2c 20 49 6e 63 2e 0a | 52 65 66 65 72 65 6e 63 |a, Inc..|Referenc|
|000001c0| 65 73 3a 20 3c 34 68 66 | 6b 70 63 24 39 65 6d 40 |es: <4hf|kpc$9em@|
|000001d0| 67 75 61 72 64 69 61 6e | 2e 66 6f 72 62 69 6e 2e |guardian|.forbin.|
|000001e0| 63 6f 6d 3e 0a 4d 69 6d | 65 2d 56 65 72 73 69 6f |com>.Mim|e-Versio|
|000001f0| 6e 3a 20 31 2e 30 0a 44 | 61 74 65 3a 20 46 72 69 |n: 1.0.D|ate: Fri|
|00000200| 2c 20 38 20 4d 61 72 20 | 31 39 39 36 20 32 32 3a |, 8 Mar |1996 22:|
|00000210| 35 32 3a 34 34 20 47 4d | 54 0a 58 2d 4d 61 69 6c |52:44 GM|T.X-Mail|
|00000220| 65 72 3a 20 4d 6f 7a 69 | 6c 6c 61 20 31 2e 31 4e |er: Mozi|lla 1.1N|
|00000230| 20 28 4d 61 63 69 6e 74 | 6f 73 68 3b 20 49 3b 20 | (Macint|osh; I; |
|00000240| 50 50 43 29 0a 58 2d 55 | 72 6c 3a 20 6e 65 77 73 |PPC).X-U|rl: news|
|00000250| 3a 34 68 66 6b 70 63 24 | 39 65 6d 40 67 75 61 72 |:4hfkpc$|9em@guar|
|00000260| 64 69 61 6e 2e 66 6f 72 | 62 69 6e 2e 63 6f 6d 0a |dian.for|bin.com.|
|00000270| 0a 67 65 6e 65 73 69 73 | 40 66 6f 72 62 69 6e 2e |.genesis|@forbin.|
|00000280| 63 6f 6d 20 28 44 61 6e | 63 65 73 20 77 69 74 68 |com (Dan|ces with|
|00000290| 20 44 65 6d 6f 6e 73 29 | 20 77 72 6f 74 65 3a 0a | Demons)| wrote:.|
|000002a0| 3e 49 20 61 6d 20 69 6e | 20 74 68 65 20 70 72 6f |>I am in| the pro|
|000002b0| 63 65 73 73 20 6f 66 20 | 6c 65 61 72 6e 69 6e 67 |cess of |learning|
|000002c0| 20 43 2b 2b 20 77 68 69 | 63 68 20 73 75 72 70 72 | C++ whi|ch surpr|
|000002d0| 69 73 65 64 20 6d 65 20 | 69 6e 20 62 65 69 6e 67 |ised me |in being|
|000002e0| 20 0a 3e 61 73 20 61 77 | 65 73 6f 6d 65 20 61 73 | .>as aw|esome as|
|000002f0| 20 65 76 65 72 79 6f 6e | 65 20 6b 65 70 74 20 74 | everyon|e kept t|
|00000300| 65 6c 6c 69 6e 67 20 6d | 65 2e 20 20 49 74 20 69 |elling m|e. It i|
|00000310| 73 20 6c 69 74 65 72 61 | 6c 6c 79 20 62 65 74 74 |s litera|lly bett|
|00000320| 65 72 0a 3e 74 68 61 6e | 20 61 6e 79 74 68 69 6e |er.>than| anythin|
|00000330| 67 20 49 20 65 76 65 72 | 20 65 78 70 65 63 74 65 |g I ever| expecte|
|00000340| 64 2e 20 20 49 20 72 61 | 6e 20 69 6e 74 6f 20 6f |d. I ra|n into o|
|00000350| 6e 65 20 64 61 72 6b 20 | 61 72 65 61 20 66 6f 72 |ne dark |area for|
|00000360| 20 6d 65 0a 3e 69 6e 20 | 74 68 65 20 61 72 65 61 | me.>in |the area|
|00000370| 20 6f 66 20 61 75 74 6f | 6d 61 74 69 63 20 76 61 | of auto|matic va|
|00000380| 72 69 61 62 6c 65 73 2e | 20 0a 3e 20 20 20 49 74 |riables.| .> It|
|00000390| 20 73 61 69 64 20 69 6e | 20 74 68 65 20 62 6f 6f | said in| the boo|
|000003a0| 6b 20 49 27 6d 20 73 74 | 75 64 79 69 6e 67 2c 20 |k I'm st|udying, |
|000003b0| 22 4f 62 6a 65 63 74 2d | 4f 72 69 65 6e 74 65 64 |"Object-|Oriented|
|000003c0| 20 50 72 6f 67 72 61 6d | 6d 69 6e 67 0a 3e 69 6e | Program|ming.>in|
|000003d0| 20 43 2b 2b 2c 20 62 79 | 20 52 6f 62 65 72 74 20 | C++, by| Robert |
|000003e0| 4c 61 66 6f 72 65 22 2c | 20 74 68 61 74 20 77 68 |Lafore",| that wh|
|000003f0| 65 6e 20 61 20 66 75 6e | 63 74 69 6f 6e 20 69 73 |en a fun|ction is|
|00000400| 20 65 78 65 63 75 74 65 | 64 2c 20 74 68 65 0a 3e | execute|d, the.>|
|00000410| 61 6e 64 20 74 68 65 20 | 76 61 72 69 61 62 6c 65 |and the |variable|
|00000420| 20 69 73 20 64 65 66 69 | 6e 65 64 2c 20 69 74 20 | is defi|ned, it |
|00000430| 77 69 6c 6c 20 63 6f 6e | 74 69 6e 75 65 20 74 6f |will con|tinue to|
|00000440| 20 65 78 69 73 74 20 75 | 6e 74 69 6c 20 74 68 65 | exist u|ntil the|
|00000450| 0a 3e 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 65 78 |.>functi|on is ex|
|00000460| 69 74 65 64 2e 20 20 57 | 68 65 6e 20 74 68 69 73 |ited. W|hen this|
|00000470| 20 68 61 70 70 65 6e 73 | 2c 20 74 68 65 20 6d 65 | happens|, the me|
|00000480| 6d 6f 72 79 20 74 68 61 | 74 20 74 68 65 20 76 61 |mory tha|t the va|
|00000490| 72 69 61 62 6c 65 0a 3e | 69 73 20 66 72 65 65 64 |riable.>|is freed|
|000004a0| 20 75 70 20 61 6e 64 20 | 69 73 20 75 73 65 64 20 | up and |is used |
|000004b0| 62 79 20 6f 74 68 65 72 | 20 76 61 72 69 61 62 6c |by other| variabl|
|000004c0| 65 73 2f 66 75 6e 63 74 | 69 6f 6e 20 63 61 6c 6c |es/funct|ion call|
|000004d0| 73 2c 20 65 74 63 2e 0a | 3e 0a 3e 54 68 65 20 71 |s, etc..|>.>The q|
|000004e0| 75 65 73 74 69 6f 6e 20 | 69 73 3a 20 20 57 68 65 |uestion |is: Whe|
|000004f0| 6e 20 79 6f 75 20 64 65 | 66 69 6e 65 20 61 20 76 |n you de|fine a v|
|00000500| 61 72 69 61 62 6c 65 20 | 69 6e 20 6d 61 69 6e 28 |ariable |in main(|
|00000510| 29 2c 20 61 6e 64 20 63 | 61 6c 6c 20 61 6e 6f 74 |), and c|all anot|
|00000520| 68 65 72 20 0a 3e 66 75 | 6e 63 74 69 6f 6e 2c 20 |her .>fu|nction, |
|00000530| 6f 72 20 65 76 65 6e 20 | 77 68 65 6e 20 64 65 66 |or even |when def|
|00000540| 69 6e 69 6e 67 20 61 20 | 6c 6f 63 61 6c 20 76 61 |ining a |local va|
|00000550| 72 69 61 62 6c 65 20 69 | 6e 20 61 20 66 75 6e 63 |riable i|n a func|
|00000560| 74 69 6f 6e 20 74 68 61 | 74 20 63 61 6c 6c 73 20 |tion tha|t calls |
|00000570| 0a 3e 61 6e 6f 74 68 65 | 72 20 66 75 6e 63 74 69 |.>anothe|r functi|
|00000580| 6f 6e 2c 20 77 68 79 20 | 61 72 65 20 74 68 65 20 |on, why |are the |
|00000590| 6c 6f 63 61 6c 20 76 61 | 72 69 61 62 6c 65 73 20 |local va|riables |
|000005a0| 6e 6f 74 20 64 65 73 74 | 72 6f 79 65 64 2e 0a 3e |not dest|royed..>|
|000005b0| 20 20 20 49 20 68 61 64 | 20 61 20 74 68 6f 75 67 | I had| a thoug|
|000005c0| 68 74 20 74 68 61 74 20 | 6d 61 79 62 65 20 73 69 |ht that |maybe si|
|000005d0| 6e 63 65 20 6d 61 69 6e | 28 29 20 63 61 6c 6c 65 |nce main|() calle|
|000005e0| 64 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 2c 20 |d the fu|nction, |
|000005f0| 69 74 20 73 74 69 6c 6c | 20 68 61 64 20 0a 3e 63 |it still| had .>c|
|00000600| 6f 6e 74 72 6f 6c 2c 20 | 28 61 74 20 6c 65 61 73 |ontrol, |(at leas|
|00000610| 74 20 61 73 20 66 61 72 | 20 61 73 20 76 61 72 69 |t as far| as vari|
|00000620| 61 62 6c 65 20 75 73 61 | 67 65 20 77 65 6e 74 29 |able usa|ge went)|
|00000630| 20 61 6e 64 20 74 68 65 | 72 65 66 6f 72 65 20 64 | and the|refore d|
|00000640| 69 64 6e 27 74 0a 3e 66 | 72 65 65 20 75 70 20 74 |idn't.>f|ree up t|
|00000650| 68 65 20 6d 65 6d 6f 72 | 79 20 75 6e 74 69 6c 20 |he memor|y until |
|00000660| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 69 73 20 |the func|tion is |
|00000670| 61 63 74 75 61 6c 6c 79 | 20 63 6f 6d 70 6c 65 74 |actually| complet|
|00000680| 65 64 2c 20 28 45 6e 64 | 0a 3e 6f 66 20 74 68 65 |ed, (End|.>of the|
|00000690| 20 70 72 6f 67 72 61 6d | 29 2c 20 62 75 74 20 49 | program|), but I|
|000006a0| 20 77 61 73 6e 27 74 20 | 73 75 72 65 2e 20 20 43 | wasn't |sure. C|
|000006b0| 6f 75 6c 64 20 73 6f 6d | 65 6f 6e 65 20 70 6c 65 |ould som|eone ple|
|000006c0| 61 73 65 20 76 65 72 69 | 66 79 20 74 68 61 74 20 |ase veri|fy that |
|000006d0| 74 68 69 73 20 69 73 20 | 0a 3e 69 6e 64 65 65 64 |this is |.>indeed|
|000006e0| 20 74 68 65 20 63 61 73 | 65 2c 20 6f 72 20 72 65 | the cas|e, or re|
|000006f0| 66 75 74 65 20 69 74 20 | 61 6e 64 20 67 69 76 65 |fute it |and give|
|00000700| 20 6d 65 20 74 68 65 20 | 72 65 61 6c 20 72 65 61 | me the |real rea|
|00000710| 73 6f 6e 2e 0a 3e 0a 3e | 49 20 74 68 61 6e 6b 20 |son..>.>|I thank |
|00000720| 79 6f 75 20 69 6e 20 61 | 64 76 61 6e 63 65 2c 20 |you in a|dvance, |
|00000730| 61 6e 79 20 68 65 6c 70 | 20 77 69 6c 6c 20 62 65 |any help| will be|
|00000740| 20 67 72 65 61 74 6c 79 | 20 61 70 70 72 65 63 69 | greatly| appreci|
|00000750| 61 74 65 64 2e 0a 3e 54 | 68 6f 6d 61 73 20 4b 6c |ated..>T|homas Kl|
|00000760| 65 6d 65 6e 73 65 6e 20 | 20 2d 20 20 67 65 6e 65 |emensen | - gene|
|00000770| 73 69 73 40 66 6f 72 62 | 69 6e 2e 63 6f 6d 0a 0a |sis@forb|in.com..|
|00000780| 0a 54 68 6f 6d 61 73 2c | 0a 0a 49 20 74 68 69 6e |.Thomas,|..I thin|
|00000790| 6b 20 79 6f 75 20 68 61 | 76 65 20 69 74 20 72 69 |k you ha|ve it ri|
|000007a0| 67 68 74 2e 20 56 61 72 | 69 61 62 6c 65 73 20 64 |ght. Var|iables d|
|000007b0| 6f 20 6e 6f 74 20 67 6f | 20 61 77 61 79 20 75 6e |o not go| away un|
|000007c0| 74 69 6c 20 74 68 65 79 | 20 67 6f 0a 6f 75 74 20 |til they| go.out |
|000007d0| 6f 66 20 73 63 6f 70 65 | 2e 20 54 68 65 20 70 72 |of scope|. The pr|
|000007e0| 65 63 69 73 65 20 6d 65 | 61 6e 69 6e 67 20 6f 66 |ecise me|aning of|
|000007f0| 20 67 6f 69 6e 67 20 6f | 75 74 20 6f 66 20 73 63 | going o|ut of sc|
|00000800| 6f 70 65 20 69 73 20 71 | 75 69 74 65 0a 63 6f 6d |ope is q|uite.com|
|00000810| 70 6c 65 78 2c 20 62 75 | 74 20 77 68 61 74 20 79 |plex, bu|t what y|
|00000820| 6f 75 20 63 61 6e 20 73 | 61 79 20 69 73 20 74 68 |ou can s|ay is th|
|00000830| 61 74 20 61 20 76 61 72 | 69 61 62 6c 65 20 64 65 |at a var|iable de|
|00000840| 66 69 6e 65 64 20 77 69 | 74 68 69 6e 0a 74 68 65 |fined wi|thin.the|
|00000850| 20 6f 75 74 65 72 20 62 | 72 61 63 6b 65 74 73 20 | outer b|rackets |
|00000860| 6f 66 20 61 20 66 75 6e | 63 74 69 6f 6e 20 63 61 |of a fun|ction ca|
|00000870| 6c 6c 20 64 6f 20 6e 6f | 74 20 67 65 74 20 64 65 |ll do no|t get de|
|00000880| 73 74 72 75 63 74 65 64 | 20 75 6e 74 69 6c 0a 74 |structed| until.t|
|00000890| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 65 78 69 74 |he funct|ion exit|
|000008a0| 73 2e 20 48 65 72 65 20 | 69 73 20 61 20 73 69 6d |s. Here |is a sim|
|000008b0| 70 6c 65 20 65 78 61 6d | 70 6c 65 0a 0a 63 6c 61 |ple exam|ple..cla|
|000008c0| 73 73 20 41 20 7b 2e 2e | 2e 7d 3b 0a 63 6c 61 73 |ss A {..|.};.clas|
|000008d0| 73 20 42 20 7b 2e 2e 2e | 7d 3b 0a 69 6e 74 20 6d |s B {...|};.int m|
|000008e0| 61 69 6e 28 69 6e 74 20 | 61 72 67 63 2c 20 63 68 |ain(int |argc, ch|
|000008f0| 61 72 20 2a 61 72 67 76 | 5b 5d 20 0a 7b 0a 20 20 |ar *argv|[] .{. |
|00000900| 41 20 61 3b 0a 0a 20 20 | 2e 2e 2e 2e 0a 20 20 66 |A a;.. |..... f|
|00000910| 75 6e 63 43 61 6c 6c 31 | 28 29 3b 0a 20 20 2f 2f |uncCall1|();. //|
|00000920| 20 61 20 69 73 20 73 74 | 69 6c 6c 20 76 61 6c 69 | a is st|ill vali|
|00000930| 64 0a 0a 20 20 69 66 20 | 28 20 73 6f 6d 65 74 68 |d.. if |( someth|
|00000940| 69 6e 67 20 29 0a 20 20 | 7b 0a 20 20 20 20 20 42 |ing ). |{. B|
|00000950| 20 62 3b 0a 20 20 20 20 | 20 2f 2f 20 61 20 69 73 | b;. | // a is|
|00000960| 20 73 74 69 6c 6c 20 76 | 61 6c 69 64 2c 20 62 20 | still v|alid, b |
|00000970| 69 73 20 76 61 6c 69 64 | 0a 20 20 20 20 20 2e 2e |is valid|. ..|
|00000980| 2e 2e 0a 20 20 20 7d 0a | 20 20 20 2f 2f 20 61 20 |... }.| // a |
|00000990| 69 73 20 76 61 6c 69 64 | 2c 20 62 20 69 73 20 6e |is valid|, b is n|
|000009a0| 6f 20 6c 6f 6e 67 65 72 | 20 76 61 6c 69 64 0a 20 |o longer| valid. |
|000009b0| 20 20 72 65 74 75 72 6e | 20 31 3b 0a 7d 0a 2f 2f | return| 1;.}.//|
|000009c0| 20 61 20 69 73 20 6e 6f | 20 6c 6f 6e 67 65 72 20 | a is no| longer |
|000009d0| 76 61 6c 69 64 0a 0a 43 | 68 65 63 6b 20 6f 75 74 |valid..C|heck out|
|000009e0| 20 74 68 65 20 63 68 61 | 70 74 65 72 73 20 6f 6e | the cha|pters on|
|000009f0| 20 73 63 6f 70 65 2c 20 | 63 6f 6e 73 74 72 75 63 | scope, |construc|
|00000a00| 74 69 6f 6e 2c 20 61 6e | 64 20 64 65 73 74 72 75 |tion, an|d destru|
|00000a10| 63 74 69 6f 6e 2e 0a 0a | 2d 42 72 69 61 6e 20 3a |ction...|-Brian :|
|00000a20| 2d 29 0a 0a | |-).. | |
+--------+-------------------------+-------------------------+--------+--------+